import React, { Component } from "react";

/*
事件传参
1.bind
2.箭头函数
3.data属性传
 */
class App extends Component {
  // handleClick=(params, e) =>{
  //   console.log(params, e);
  // }
  handleClick=(e)=>{
    console.log(e)
    console.log(e.currentTarget.dataset["index"])
  }
  render() {
    return (
      <div>
        {/* <button onClick={this.handleClick.bind(this,"🐂")}>传参</button> */}
        {/* <button
          onClick={(e) => {
            this.handleClick("🐂", e);
          }}
        >传参</button> */}
        <button data-index={"🐂"} onClick={this.handleClick}>传参</button>
      </div>
    );
  }
}

export default App;
